package com.example.mapper;

import com.example.bean.Student;
import com.example.sql.ReturnSql;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;

import java.util.List;

/*
    持久层接口
 */
public interface StudentSelectProviderMapper {
    //查询全部
    @SelectProvider(type = ReturnSql.class, method = "getSelectAll")
    List<Student> selectAll();

    //根据id查询
    @SelectProvider(type = ReturnSql.class, method = "getSelectById")
    Student selectById(Integer id);

    //新增数据
    @InsertProvider(type = ReturnSql.class, method = "getInsert")
    Integer insert(Student stu);

    //修改数据
    @UpdateProvider(type = ReturnSql.class, method = "getUpdate")
    Integer update(Student stu);

    //删除数据
    @DeleteProvider(type = ReturnSql.class, method = "getDelete")
    Integer delete(Integer id);

}
